<a href="javascript:history.back();">Wróć</a>
		<?php if ($this->user->isAdmin()):?>
			| <a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'new', 'catId' => $this->category->id), null, true);?>">
				Nowa książka
			</a>
		<?php endif; ?>
<table class="waiting">
    <caption><?php echo $this->category->nazwa?></caption>
    <tr>
        <td>Tytuł</td>
        <td>Autor</td>
        <td>Język</td>
        <td>Strony</td>
        <td>Nośnik</td>
        <td>Rok</td>
        <td>Miejsce Wydania</td>
        <td>Id Wydawinictwa</td>
        <td>ISBN</td>
        <td>&nbsp;</td>
    </tr>
    
<?php foreach ($this->category->getBooks() as $book):?>

<?php foreach ($book->getEditions() as $edition): ?>

	<tr>
		<?php 
			$author = $edition->getMainAuthor();
		?>
		<td><?php echo $edition->tytul; ?></td>
		<td><?php echo $author->imie; ?> <?php echo $author->nazwisko; ?></td>
		<td><?php echo $edition->jezyk; ?></td>
		<td><?php echo $edition->strony; ?></td>
		<td><?php echo $edition->nosnik; ?></td>
		<td><?php echo $edition->rok; ?></td>
		<td><?php echo $edition->miejsceWydania; ?></td>
		<td><?php echo $edition->idWydawnictwa; ?></td>
		<td><?php echo $edition->isbn; ?></td>
		<td>
		<a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'order', 'isbn' => $edition->isbn), null, true);?>">
			Zamów (<?php echo $edition->dostepne?>)</a>
			
		<?php if ($this->user->isAdmin()):?>
			| <a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'new', 'bookId' => $edition->idKsiazki, 'catId' => $this->category->id), null, true);?>">
				Nowe wydanie
			</a>
			| <a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'new-copy', 'isbn' => $edition->isbn), null, true);?>">
				Nowy egzemplarz
			</a>
			| <a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'edit', 'isbn' => $edition->isbn), null, true);?>">
				Edytuj
			</a>
			| <a href="<?php echo $this->url(array('controller' => 'book', 'action' => 'delete', 'isbn' => $edition->isbn), null, true);?>">
				Usuń
			</a>
		<?php endif; ?>
		</td>
	
	</tr>
<?php endforeach; ?>

<?php endforeach; ?>
</table>